
const express = require('express');
const app = express();
const port = 8080;
const users = [
    { username: 'admin', password: 'password123' }
];
app.use(express.json());
app.get("/",(req,res)=>{
    const user = users.find(u => u.username === req.query.username && u.password === req.query.username);
    if (user) {
        res.json({ code: 200, msg: "登录成功" });
    } else {
        res.status(401).json({ code: 401, msg: "登录失败" });
    }
})
app.listen(port, () => {
    console.log("监听端口"+port);
});